#include "JSONData.h"

// Let say x is a JSON_Value Object,
// then if JSON_Type is JSON_OBJECT, then
// JSON_Object * jo = (JSON_Object)x.data;

int main()
{
	JSON_Object jo("   { \t\"name\" : \"value\", \"age\" : { \"A\" : \"10\", \"B\" : \"20\" } , \"pp\" : \"oo\"} ");
	JSON_Object kk("{ \"A\" : \"10\", \"B\" : \"20\" }");
	JSON_Abstract * ak = kk.getValueForKey("B");
	if (ak) std::cout << "AK = " << ak->getValueAsString() << std::endl;
	JSON_Abstract * ab1 = jo.getValueForKey("name");
	JSON_Abstract * ab2 = jo.getValueForKey("age");
	if (ab1)
	{
		std::cout << "name => " << ab1->getValueAsString() << std::endl;
	}
	if (ab2)
	{
		JSON_Object * jobj = (JSON_Object*)ab2;
		JSON_Abstract * pp = jobj->getValueForKey("B");
		
		if (pp) std::cout << "B => " << pp->getValueAsString() << std::endl;
	}

	JSON_Array jarr ("[ \"ddd\", \"ffff\" ]");
	std::cout << jarr.getElementCount() << std::endl;
	//JSON_Object * param = (JSON_Object *)jo.getValue("param");
	//JSON_String * param2 = (JSON_String *)param->getValue("param2");
	//std::string strValue = param2->str();
	//JSON_Array * param3 = (JSON_Array *)param->getValue("param3");
	//JSON_Number * num = (JSON_Number *)param3->getValue(0);
	//float number = num->number();

	return 0;
}